package com.village.friend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.village.friend.entity.Activity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author yl
 * @since 2021-08-13
 */
@Mapper
public interface ActivityMapper extends BaseMapper<Activity> {

    List<Activity> list(Integer createUserId, Integer joinUserId, Integer reqUserId, Integer type, Integer gender, String city, Double latitude, Double longitude, Integer limit, Integer offset);

    Integer listCount(Integer createUserId, Integer joinUserId, Integer reqUserId, Integer type, Integer gender, String city);

    @Select("select count(1) from  activity where user_id=#{userId} and create_time> concat(DATE_ADD(curdate(),interval -day(curdate())+1 day),' 00:00:00') ")
    Integer getActivityCountToMonth(Integer userId);

}
